package jhlee42;

public class J16Ch05Print {

	public static void main(String[] args) {
		J16Print p = new J16Print("중소기업","번들제품","USB2.0");
		System.out.println(p.toString());

		J16InkjetPrinter ip = new J16InkjetPrinter("휴렛페커드","잉크젯프린터","USB3.0");
		System.out.println(ip.toString());
		
		J16PrinterService ps = new J16PrinterService();
		ps.print(p);
		ps.print(ip);

	} // main

} // class

class J16Print{
	private String maker;
	private String model;
	private String interfaces;
	private int counts;
	private int remains;
	
	
	public J16Print(String maker,String model,String interfaces/*, int counts, int remains*/){
		this.maker=maker;
		this.model=model;
		this.interfaces=interfaces;
/*		this.counts=counts;
		this.remains=remains;*/
		
	}


	public String getMaker() {
		return maker;
	}


	public void setMaker(String maker) {
		this.maker = maker;
	}


	public String getModel() {
		return model;
	}


	public void setModel(String model) {
		this.model = model;
	}


	public String getInterfaces() {
		return interfaces;
	}


	public void setInterfaces(String interfaces) {
		this.interfaces = interfaces;
	}


/*	public int getCounts() {
		return counts;
	}


	public void setCounts(int counts) {
		this.counts = counts;
	}


	public int getRemains() {
		return remains;
	}


	public void setRemains(int remains) {
		this.remains = remains;
	}*/
	
	
	@Override
	public String toString() {
		String remain = "";
		remain += maker +"/"+ model +"/"+ interfaces +"/"+ counts +"/"+ remains;
		return remain;
	}
	
}

class J16InkjetPrinter extends J16Print {

	public J16InkjetPrinter(String maker, String model, String interfaces) {
		super(maker, model, interfaces);
		// super() - 부모 클래스의 생성자를 가리키는 말 
	}
	// 부모 클래스에 기본 생성자가 정의 되지 않았기 때문에 자식 클래스에서 따로 생성자를 정의해둬야 함.
} // J16Inkjet




interface J16prInterIServices{
	void print(J16Print p);
}

class J16PrinterService implements J16prInterIServices {

	@Override
	public void print(J16Print p) {
		String result = p.getModel() + "가 문서를 출력합니다.";
		System.out.println(result);
	}// print
	
	
} //  J16PrinterService implements J16prInterIServices




